import java.net.InetSocketAddress;

import com.siao.example.socket.DataPack;
import com.siao.example.socket.DataResolver;
import com.siao.net.socket.ConnectionPool;

public class SocketPoolExample {

	public static void main(String[] args) {
		DataPack data = new DataPack(2000, "HELLO".getBytes());

		ConnectionPool pool = new ConnectionPool(10, 4);
		pool.dataResolver = new DataResolver();
		pool.connect(new InetSocketAddress("localhost", 8888));
		pool.request(data);
		pool.request(data);
		// pool.post(data);
		// pool.post(data);
		// pool.post(data);
		// pool.post(data);

		try {
			Thread.sleep(2000);
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		pool.close();
	}

}
